package com.pascualabs.android.lwspring;

import android.os.Build;
import android.os.Bundle;

import com.google.ads.*;
import com.pascualabs.android.lwsnowing.R;
import android.app.Activity;
import android.app.WallpaperManager;
import android.content.ComponentName;
import android.content.Intent;
import android.util.DisplayMetrics;
import android.view.View;

public class LauncherActivity extends Activity {
	private AdView adView;
	private AdView adView2;
	public static DisplayMetrics metrics;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_launcher);

		metrics = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(metrics);

		adView = (AdView) findViewById(R.id.adView);
		adView.loadAd(new AdRequest());

		adView2 = (AdView) findViewById(R.id.adView2);
		adView2.loadAd(new AdRequest());

	}

	@Override
	public void onDestroy() {
		if (adView != null)
			adView.destroy();
		super.onDestroy();
	}

	// @Override
	// public boolean onCreateOptionsMenu(Menu menu) {
	// getMenuInflater().inflate(R.menu.launcher, menu);
	// return true;
	// }

	public void onClick(View view) {

		Intent intent = new Intent();

		if (Build.VERSION.SDK_INT >= 16) {
			intent.setAction(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
			intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
					new ComponentName(this, BaseGame.class));
		} else {
			intent.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
		}

		startActivity(intent);

	}

}
